<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<div class="mainBody" style="overflow: auto;width:680px">
    <div class="editBody">
       <?php echo form_open('newtask/submit_task/'.$app['app_id']); ?>
       <input type="hidden" name='os' value='<?php echo $cur_os;?>' />
       <input type="hidden" name='group_id' value='<?php echo $cur_group;?>' />
        <div class="bodyTitle">
            <div class="titleIcon editTitle"></div>
            <p class="titleName fontDinproMedium" style="">Pack</p>
        </div>
        <div class="bodyDiv fontDinpro">
	        <div class="divContent">
	        	<p class="fontDinproMedium">App</p>
	        	<div class="rightContent">
		            <div class="locationGroup listGroupDown listGroup">
		                <a class="btnLeft btnPrimary fontDinpro" data-toggle="dropdown" href="javascript:void(0)" link="">
		                    <?php
		                          echo $appnames[$cur_appid];
		                    ?>
		                </a>
		                <a class="btnRight btnPrimary" data-toggle="dropdown" href="javascript:void(0)"><span class="caretBottom"></span></a>
		                <ul class="dropDownList fontDinpro">
		                    <?php foreach($appnames as $k=>$r): ?>
		                        <li>
		                            <a href="javascript:void(0)" class="fontDinpro" link="<?php echo backend_url($language.'/newtask/pack'); ?>/<?php echo $k; ?>/<?php echo $cur_os.'/'.$cur_group; ?>">
		                                <?php echo $r; ?>
		                            </a>
		                        </li>
		                    <?php endforeach; ?>
		                </ul>
		            </div>
	        	</div>
	        </div>
            <div class="divContent">
	        	<p class="fontDinproMedium">OS</p>
	        	<div class="rightContent">
		            <div class="locationGroup listGroupDown listGroup">
		                <a class="btnLeft btnPrimary fontDinpro" data-toggle="dropdown" href="javascript:void(0)" link="">
		                    <?php
		                    	echo $os[$cur_os];
		                    ?>
		                </a>
		                <a class="btnRight btnPrimary" data-toggle="dropdown" href="javascript:void(0)"><span class="caretBottom"></span></a>
		                <ul class="dropDownList fontDinpro">
		                    <?php foreach($os as $k=>$r): ?>
		                        <li>
		                            <a href="javascript:void(0)" class="fontDinpro" link="<?php echo backend_url($language.'/newtask/pack/'.$app['app_id'].'/'.$k.'/'.$cur_group); ?>">
		                                <?php echo $r; ?>
		                            </a>
		                        </li>
		                    <?php endforeach; ?>
		                </ul>
		            </div>
		        </div>
	        </div>
            <div class="divContent">
	        	<p class="fontDinproMedium">GROUP</p>
	        	<div class="rightContent">
		            <div class="locationGroup listGroupDown listGroup">
		                <a class="btnLeft btnPrimary fontDinpro" data-toggle="dropdown" href="javascript:void(0)" link="">
		                    <?php
		                    	echo empty($chcode_group_names[$cur_group])?"未配置":$chcode_group_names[$cur_group];
		                    ?>
		                </a>
		                <a class="btnRight btnPrimary" data-toggle="dropdown" href="javascript:void(0)"><span class="caretBottom"></span></a>
		                <ul class="dropDownList fontDinpro">
		                    <?php foreach($chcode_group_names as $k=>$r): ?>
		                        <li>
		                            <a href="javascript:void(0)" class="fontDinpro" link="<?php echo backend_url($language.'/newtask/pack/'.$app['app_id'].'/'.$cur_os.'/'.$k); ?>">
		                                <?php echo $r; ?>
		                            </a>
		                        </li>
		                    <?php endforeach; ?>
		                </ul>
		            </div>
		        </div>
	        </div>
        </div>
        <div class="bodyDiv fontDinpro">
            <div class="divContent">
                <p class="fontDinproMedium">AppID:</p>
                <div class="rightContent">
                    <label class="fontDinpro"><?php echo $app['app_id'];?></label>
                </div>
            </div>
        </div>
        <div class="bodyDiv fontDinpro">
            <div class="divContent">
                <p class="fontDinproMedium">Icon:</p>
                <div class="rightContent">
                	<img width='80px' src="<?php echo $app['icon']==''?'img/common/defaultIcon.png':$this->config->item('res_domain').$app['icon']; ?>"/>
                </div>
            </div>
        </div>
        <div id="messagecontent" class="bodyDiv fontDinpro">
            <div class="divContent">
                <p class="fontDinproMedium">Version:</p>
				<div class="rightContent">
               		<?php
               		if(empty($pack_appinfo)){
               			echo "<span class='colorLabel'>还没有版本</span>";
               		}else{
               			foreach($pack_appinfo as $appinfo){
       				?>
							<li><input type="radio" value="<?php echo $appinfo['version'];?>" name="version" /><label><?php echo $appinfo['version'];?></label></li>
               		<?php
           				}
					}
					?>
               	</div>
            </div>
        </div>
        <div class="bodyDiv fontDinpro">
            <div class="divContent">
	            <p class="fontDinproMedium">选择渠道:</p>
	            <div class="rightContent">
			        <?php
			        	if(empty($list)) echo "<span class='colorLabel'>未设置渠道</span>";
			        	foreach($list as $chcode): ?>
			        		<p class="fontDinproMedium">
			        		<input type="checkbox" name="chcode[]" value="<?php echo $chcode;?>" />
			        		<?php echo "{$chcode_names[$chcode]}-$chcode";?></p>
			        <?php endforeach;?>
        		</div>
       		</div>
        </div>
        <button class="btn submitBtn fontDinproBold" href="javascript:void(0)" type='submit'>SUMBIT</button>
       <?php echo form_close(); ?>
    </div>
</div>
<script>
    function saveParams(appid, chcode){
		var params = $("#params_"+chcode).val();
		$.ajax({
			url : "<?php echo base_url('app/edit_app_param');?>/"+appid+"/"+chcode,
			cache : false,
			type : 'POST',
			data : {
				'params' : params
			}
		}).done(function(result) {
			if (result == '') {
				alert('更新成功');
			} else {
				 alert(result);
			}
		});
    }

</script>